package ch.rheintalconnection.sysventory.technicalServices.wmi;

import java.util.List;

import ch.rheintalconnection.sysventory.dto.ComputerDto;
import ch.rheintalconnection.sysventory.dto.LogicalDiskDto;
import ch.rheintalconnection.sysventory.dto.NicDto;
import ch.rheintalconnection.sysventory.dto.OperatingSystemDto;
import ch.rheintalconnection.sysventory.dto.PrinterConfigurationDto;
import ch.rheintalconnection.sysventory.dto.PrinterDto;
import ch.rheintalconnection.sysventory.dto.ProcessorDto;
import ch.rheintalconnection.sysventory.dto.ProgramDto;
import ch.rheintalconnection.sysventory.technicalServices.IHostScanner;

import com.jacob.activeX.ActiveXComponent;

public class WMIHostScanner implements IHostScanner {

	private NICScan nicscan;
	private ComputerScan computerScan;
	private OperatingSystemScan operatingSystemScan;
	private PrinterScan printerScan;
	private ProcessorScan processorScan;
	private ProgramScan programScan;
	private LogicalDiskScan logicalDiskScan;
	private PrinterConfigurationScan printerConfigurationScan;
	
	public WMIHostScanner(String host){
		String connectStr = String.format("winmgmts:\\\\%s\\root\\CIMV2", host);
		ActiveXComponent axWMI = new ActiveXComponent(connectStr);
		
		nicscan = new NICScan(axWMI);
		computerScan = new ComputerScan(axWMI);
		logicalDiskScan = new LogicalDiskScan(axWMI);
		operatingSystemScan = new OperatingSystemScan(axWMI);
		printerScan = new PrinterScan(axWMI);
		printerConfigurationScan = new PrinterConfigurationScan(axWMI);
		processorScan = new ProcessorScan(axWMI);
		programScan = new ProgramScan(axWMI);
	}

	public NicDto scanNic() {
		
		return nicscan.scan();
	}

	public ComputerDto scanComputer() {
		return computerScan.scan();
	}

	public LogicalDiskDto scanLogicalDisk() {
		return logicalDiskScan.scan();
	}

	public OperatingSystemDto scanOperatingSystem() {
		return operatingSystemScan.scan();
	}

	public List<PrinterDto> scanPrinters() {
		return printerScan.scan();
	}

	public ProcessorDto scanProcessor() {
		return processorScan.scan();
	}

	public List<ProgramDto> scanPrograms() {
		return programScan.scan();
	}

	public List<PrinterConfigurationDto> scanPrinterConfigurations() {
		return printerConfigurationScan.scan();
	}
}
